// pages/order/orderInstallConfirmTwo/orderInstallConfirmTwo.js
var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    work_order_id: "",
    realname: "",//真实名字
    type: '', //数据类型 0试用,1新装
    info: '',
    effect_date: '',//生效时间
    contract_type: '',//合同类型
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    var realname = options.realname ? options.realname : '';
    var work_order_id = options.work_order_id;
    var type = options.type;
    var that = this;
    that.setData({
      realname,
      work_order_id,
      type,
    })
    that.getInfo();
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  //获取确认单分享数据
  getInfo() {
    var that = this;
    app.ajax({
      url: 'Engineer/Workorder/calculation_efficient_money',
      method: "POST",
      data: {
        work_order_id: that.data.work_order_id,
        type: that.data.type,
      },
      success: function (res) {
        if (res.data.code == 1000) {
          that.setData({
            info: res.data.data.data,
            effect_date: res.data.data.effect_date,
            contract_type: res.data.data.contract_type,
          })
        }
      }
    })
  },

  //返回
  back(){
    wx.navigateBack();
  },
  //签名
  sign(){
    var that = this;
    var id = that.data.work_order_id;
    var name = that.data.realname;
    var type = that.data.type;
    wx.navigateTo({
      url: '../sign/sign?work_order_id=' + id + '&realname=' + name + '&type=' + type,
    })
  },
})